﻿
namespace BEGDC.PreContract.DAL
{
    using System;
    using System.Collections.Generic;
    using Castle.ActiveRecord;
    using NHibernate.Expression;


    [ActiveRecord]
    public partial class AdvanceSearch : ActiveRecordBase<AdvanceSearch>
    {
		#region Const Definition
		
		public const string CONST_SearchID								= "SearchID";
		public const string CONST_EmployeeID							= "EmployeeID";
		public const string CONST_SearchType							= "SearchType";
		public const string CONST_SearchName							= "SearchName";
		public const string CONST_Description							= "Description";
		public const string CONST_SearchSQL								= "SearchSQL";
		public const string CONST_SearchCondition						= "SearchCondition";
		public const string CONST_SearchField							= "SearchField";

		#endregion
		
        #region Member Variables
        // Primary Key
        private System.Int32 _searchID;
        
        // Non Key
        private System.String _searchType;
        private System.String _searchName;
        private System.String _description;
        private System.String _searchSQL;
        private System.String _searchCondition;
        private System.String _searchField;

        // Parents
        private Employee _employeeID;
        
        
		

        #endregion

        public AdvanceSearch() {
               
        }
        public AdvanceSearch(
            System.String searchType
            ,System.String searchName
            ,System.String description
            ,System.String searchSQL
            ,System.String searchCondition
            ,System.String searchField) : this() {
                
            this._searchType = searchType; 
            this._searchName = searchName; 
            this._description = description; 
            this._searchSQL = searchSQL; 
            this._searchCondition = searchCondition; 
            this._searchField = searchField; 
        }
        
        #region Properties
        // Primary Key        
		
		#if (SQLServer)
        [PrimaryKey]
		#else
		[PrimaryKey(PrimaryKeyType.Native, SequenceName = "SEQ_ADVANCESEARCH_SEARCHID")]
		#endif
        public System.Int32 SearchID {
            get { return this._searchID; }
            set {  this._searchID = value; }
        }
        
        // Non Key
        [Property]
        public System.String SearchType {
            get { return this._searchType; }
			set { if (value == null) return; if (value.Length > 20) this._searchType = value.Substring(0,20); else this._searchType = value; }	
        }
        
        [Property]
        public System.String SearchName {
            get { return this._searchName; }
			set { if (value == null) return; if (value.Length > 50) this._searchName = value.Substring(0,50); else this._searchName = value; }	
        }
        
        [Property]
        public System.String Description {
            get { return this._description; }
			set { if (value == null) return; if (value.Length > 2000) this._description = value.Substring(0,2000); else this._description = value; }	
        }
        
        [Property]
        public System.String SearchSQL {
            get { return this._searchSQL; }
			set { if (value == null) return; if (value.Length > 8000) this._searchSQL = value.Substring(0,8000); else this._searchSQL = value; }	
        }
        
        [Property]
        public System.String SearchCondition {
            get { return this._searchCondition; }
			set { if (value == null) return; if (value.Length > 8000) this._searchCondition = value.Substring(0,8000); else this._searchCondition = value; }	
        }
        
        [Property]
        public System.String SearchField {
            get { return this._searchField; }
			set { if (value == null) return; if (value.Length > 8000) this._searchField = value.Substring(0,8000); else this._searchField = value; }	
        }
        
        
        // Parent Relationships
        [BelongsTo("EmployeeID")]
        public Employee EmployeeID {
            get { return this._employeeID; }
            set { this._employeeID = value; }
        }
        
        // Child Relationships
        
		
        #endregion
		
		// Clone
		public AdvanceSearch Clone()
		{
			AdvanceSearch newAdvanceSearch = new AdvanceSearch();
			
            newAdvanceSearch.SearchType = this._searchType; 
            newAdvanceSearch.SearchName = this._searchName; 
            newAdvanceSearch.Description = this._description; 
            newAdvanceSearch.SearchSQL = this._searchSQL; 
            newAdvanceSearch.SearchCondition = this._searchCondition; 
            newAdvanceSearch.SearchField = this._searchField; 
            newAdvanceSearch.EmployeeID = this._employeeID ; 
			return newAdvanceSearch;
		}
    }
}



